<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>牛牛商城-注册</title>
	<link rel="stylesheet" type="text/css" href="{{ static('css/reset.css') }}">
	<link rel="stylesheet" type="text/css" href="{{ static('css/main.css') }}">
    <script type="text/javascript" src="{{ static('js/vue-2.5.16.js') }}"></script>
    <script type="text/javascript" src="{{ static('js/axios-0.18.0.min.js') }}"></script>
    <script>
        function check() {       //当不满足条件的时候是浅紫色，满足条件的时候变色
             var form = document.getElementById('login');
             var username = document.getElementsByName('username')[0].value;
             var password = document.getElementsByName('password')[0].value;
             var password2 = document.getElementsByName('password2')[0].value;
             var mobile = document.getElementsByName('mobile')[0].value;
             var image_code = document.getElementsByName('image_code')[0].value;   //图形验证码
             var sms_code = document.getElementsByName('sms_code')[0].value;       //短信验证码
             var allow = document.getElementById('allow').checked;
              var button =document.getElementById('a_submit');       //注意Id是element，不是elements！！
             if (username && username.length >= 5 && username.length <=20 && password && password.length >= 8 && password.length <=20 && password2 && password2.length >= 8 && password2.length <=20&& mobile.length==11 && image_code.length==4 && sms_code.length==6 && allow)
			 {
                 button.disabled=false;
                 button.style.background='#FF0066';
				 //document.getElementById('a_submit').disabled=true;
             }
			else
			{
				button.disabled=true;
                button.style.background='#E6E6FA';
			}
        }
    </script>
</head>
<body>
    <div id="app">
	<div class="register_con">
		<div class="l_con fl">
			<a href="{{ url('contents:index') }}" class="reg_logo">
				<img src="../static/images/logo.png"alt="some_logo"width="120px"height="100px"></a>
<!--			<div class="reg_slogan">-->

<!--			</div>-->
			<div>
				<img src="../static/images/logo4.png"alt="some_logo"width="600px"height="400px"></a>
			</div>
		</div>
		<div class="r_con fr">
			<div class="reg_title clearfix">
				<h1>用户注册</h1>
				<a href="{{ url('users:login') }}">登录</a>
			</div>
			<div class="reg_form clearfix">
				<form method="post" class="register_form" @submit="on_submit" v-cloak>
                    {{ csrf_input }}
					<ul>
						<li>
							<label>用户名:</label>
							<input type="text" v-model="username" @blur="check_username" name="username" id="user_name" oninput="check()" style="border-radius:20px;">
							<span class="error_tip" v-show="error_name">[[ error_name_message ]]</span>
						</li>
						<li>
							<label>密码:</label>
							<input type="password" v-model="password" @blur="check_password" name="password" id="pwd" oninput="check()" style="border-radius:20px;">
							<span class="error_tip" v-show="error_password">请输入8-20位的密码</span>
						</li>
						<li>
							<label>确认密码:</label>
							<input type="password" v-model="password2" @blur="check_password2" name="password2" id="cpwd" oninput="check()" style="border-radius:20px;">
							<span class="error_tip" v-show="error_password2">两次输入的密码不一致</span>
						</li>
						<li>
							<label>手机号:</label>
							<input type="text" v-model="mobile" @blur="check_mobile" name="mobile" id="phone" oninput="check()" style="border-radius:20px;">
							<span class="error_tip" v-show="error_mobile">[[ error_mobile_message ]]</span>
						</li>
						<li>
							<label>图形验证码:</label>
							<input type="text" v-model="image_code" @blur="check_image_code" name="image_code" id="pic_code" class="msg_input" oninput="check()" style="border-radius:20px;">
							<img :src="image_code_url" @click="generate_image_code" alt="图形验证码" class="pic_code" style="cursor:pointer;">
							<span class="error_tip" v-show="error_image_code">[[ error_image_code_message ]]</span>
						</li>
						<li>
                            <label>短信验证码:</label>
                           <input type="text" v-model="sms_code" @blur="check_sms_code" name="sms_code" id="msg_code" class="msg_input" oninput="check()" style="border-radius:20px;">
                            <a @click="send_sms_code" class="get_msg_code" style="border-radius:20px;cursor:pointer;">[[ sms_code_tip ]]</a>
                            <span v-show="error_sms_code" class="error_tip">[[ error_sms_code_message ]]</span>

                            {% if sms_code_errmsg %}
                                <span class="error_tip">{{ sms_code_errmsg }}</span>
                            {% endif %}
                        </li>
						<li class="agreement">
							<input type="checkbox" v-model="allow" @change="check_allow" name="allow" id="allow" oninput="check()" style="border-radius:20px;cursor:pointer;">
							<label>同意”牛牛商城用户使用协议“</label>
							<span class="error_tip" v-show="error_allow">请勾选用户协议</span>

                            {% if register_errmsg %}
                                <span class="error_tip">{{ register_errmsg }}</span>
                            {% endif %}
                        </li>
						<li class="reg_sub">
							<input type="submit" style="width:380px;height:40px;background-color:#E6E6FA;border:0;cursor: pointer;border-radius:12px;" id="a_submit" disabled=true value="注册">
						<!--							不能写成disabled=‘true’！这样无法识别！true是指禁用-->

						</li>
					</ul>
				</form>
			</div>
		</div>
	</div>
	<div class="footer no-mp">
		<div class="foot_link">
			<a href="#">关于我们</a>
			<span>|</span>
			<a href="#">联系我们</a>
			<span>|</span>
			<a href="#">招聘人才</a>
			<span>|</span>
			<a href="#">友情链接</a>
		</div>
		<p>CopyRight © 2021 重庆勇敢牛牛商业股份有限公司 All Rights Reserved</p>
		<p>电话：010-****888    京ICP备*******8号</p>
	</div>
    </div>
    <script src="{{ static('js/common.js') }}"></script>
    <script src="{{ static('js/register.js') }}"></script>
</body>
</html>